import requests


# # 请求地址 get请求
# url = 'https://httpbin.org/get?name=wh'
#
# # 请求参数
# param = {
# 	'age': 18,
# 	'sex': 'male'
# }
# # 发起请求
# response = requests.get(url,params=param)
# # status_code 请求状态码
# if response.status_code == 200:
# 	print(response.text)
# 	print(response.request.headers)


# # 请求地址 post请求
# url  = 'https://httpbin.org/post'
# # 添加请求体 data会添加到“from"中
# data_content = {
# 	'name': '张三',
# 	'age': 18
# }
# # 添加请求头
# header = {
# 	'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36',
# }
#
# response = requests.post(url,data=data_content,headers=header)
#
# if response.status_code == 200:
# 	print(response.text)
# 	print(response.request.headers['User-Agent'])


# url  = 'https://httpbin.org/post'
# # 添加请求体 json会添加到“data"中
# json_content = {
# 	'name': '张三',
# 	'age': 18
# }
# # 添加请求头
# header = {
# 	'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36',
# }
#
# response = requests.post(url,json=json_content,headers=header)
#
# if response.status_code == 200:
# 	print(response.text)
# 	print(response.request.headers['User-Agent'])


# url = 'https://pic.rmb.bdstatic.com/bjh/250905/dump/0eb62fee1b784554800fb61d50c778d7.jpeg'
#
# requests = requests.get(url)
# with open('static/1.jpeg','wb') as f:
#     f.write(requests.content)
#     print('下载完成')